= simple_form_for([:admin, @backup]) do |f|
  .card[
    data-controller="admin-cron"
    data-admin-cron-parsing-value="#{t('simple_form.labels.backup.parsing')}"
  ]
    .card-header
      h3.card-title = t('simple_form.labels.backup.general')
    .card-body
      = f.error_notification

      = f.input :enabled, as: :boolean
      = f.input :key, required: true
      = f.input :max_keeps, required: true
      / = f.input :notification

    .card-header.pt-0
      h3.card-title = t('admin.backups.new.schedule')
    .card-body
      = f.input :schedule, required: true, input_html: { data: { action: 'admin-cron#parse' } }

      .form-group.string.required.backup_schedule.form-group-valid
        label.string.required for="backup_schedule"
          = t('simple_form.labels.backup.next_schedule_at')
        input.form-control[
          type="text"
          data-admin-cron-target="source"
          disabled="true"
          value="#{@backup.schedule ? next_schedule_to_human(@backup.schedule) : ''}"
        ]

    .card-header.pt-0
      h3.card-title = t('simple_form.labels.backup.schedule_settings')
    .card-body
      = f.input :enabled_apps, as: :check_boxes, collection: all_apps, checked: @backup.enabled_apps
      = f.label :enabled_database
      = f.input :enabled_database, label: t('simple_form.labels.backup.database_switch')

    .card-footer
      - unless @backup.new_record?
        .float-end
          - if @backup.enabled
            = button_link_to t('admin.backups.new.disable'), disable_admin_backup_path(@backup), \
              class: 'btn-warning', data: { turbo_method: :post }
          - else
            = button_link_to t('admin.backups.new.enable'), enable_admin_backup_path(@backup), \
              class: 'btn-success', data: { turbo_method: :post }

      = f.button :submit
